Optimal. Leaf size=46 \[ \frac {b (2 a-b) \tan (e+f x)}{f}+x (a-b)^2+\frac {b^2 \tan ^3(e+f x)}{3 f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.03, antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3661, 390, 203} \[ \frac {b (2 a-b) \tan (e+f x)}{f}+x (a-b)^2+\frac {b^2 \tan ^3(e+f x)}{3 f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 203
Rule 390
Rule 3661
Rubi steps
\begin {align*} \int \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (a+b x^2\right )^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\operatorname {Subst}\left (\int \left ((2 a-b) b+b^2 x^2+\frac {(a-b)^2}{1+x^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(2 a-b) b \tan (e+f x)}{f}+\frac {b^2 \tan ^3(e+f x)}{3 f}+\frac {(a-b)^2 \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=(a-b)^2 x+\frac {(2 a-b) b \tan (e+f x)}{f}+\frac {b^2 \tan ^3(e+f x)}{3 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.59, size = 73, normalized size = 1.59 \[ \frac {\tan (e+f x) \left (b \left (6 a-b \left (3-\tan ^2(e+f x)\right )\right )+\frac {3 (a-b)^2 \tanh ^{-1}\left (\sqrt {-\tan ^2(e+f x)}\right )}{\sqrt {-\tan ^2(e+f x)}}\right )}{3 f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.42, size = 51, normalized size = 1.11 \[ \frac {b^{2} \tan \left (f x + e\right )^{3} + 3 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} f x + 3 \, {\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )}{3 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 1.84, size = 382, normalized size = 8.30 \[ \frac {3 \, a^{2} f x \tan \left (f x\right )^{3} \tan \relax (e)^{3} - 6 \, a b f x \tan \left (f x\right )^{3} \tan \relax (e)^{3} + 3 \, b^{2} f x \tan \left (f x\right )^{3} \tan \relax (e)^{3} - 9 \, a^{2} f x \tan \left (f x\right )^{2} \tan \relax (e)^{2} + 18 \, a b f x \tan \left (f x\right )^{2} \tan \relax (e)^{2} - 9 \, b^{2} f x \tan \left (f x\right )^{2} \tan \relax (e)^{2} - 6 \, a b \tan \left (f x\right )^{3} \tan \relax (e)^{2} + 3 \, b^{2} \tan \left (f x\right )^{3} \tan \relax (e)^{2} - 6 \, a b \tan \left (f x\right )^{2} \tan \relax (e)^{3} + 3 \, b^{2} \tan \left (f x\right )^{2} \tan \relax (e)^{3} + 9 \, a^{2} f x \tan \left (f x\right ) \tan \relax (e) - 18 \, a b f x \tan \left (f x\right ) \tan \relax (e) + 9 \, b^{2} f x \tan \left (f x\right ) \tan \relax (e) - b^{2} \tan \left (f x\right )^{3} + 12 \, a b \tan \left (f x\right )^{2} \tan \relax (e) - 9 \, b^{2} \tan \left (f x\right )^{2} \tan \relax (e) + 12 \, a b \tan \left (f x\right ) \tan \relax (e)^{2} - 9 \, b^{2} \tan \left (f x\right ) \tan \relax (e)^{2} - b^{2} \tan \relax (e)^{3} - 3 \, a^{2} f x + 6 \, a b f x - 3 \, b^{2} f x - 6 \, a b \tan \left (f x\right ) + 3 \, b^{2} \tan \left (f x\right ) - 6 \, a b \tan \relax (e) + 3 \, b^{2} \tan \relax (e)}{3 \, {\left (f \tan \left (f x\right )^{3} \tan \relax (e)^{3} - 3 \, f \tan \left (f x\right )^{2} \tan \relax (e)^{2} + 3 \, f \tan \left (f x\right ) \tan \relax (e) - f\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.03, size = 87, normalized size = 1.89 \[ \frac {b^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {2 a b \tan \left (f x +e \right )}{f}-\frac {b^{2} \tan \left (f x +e \right )}{f}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) a^{2}}{f}-\frac {2 \arctan \left (\tan \left (f x +e \right )\right ) a b}{f}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) b^{2}}{f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.85, size = 58, normalized size = 1.26 \[ a^{2} x - \frac {2 \, {\left (f x + e - \tan \left (f x + e\right )\right )} a b}{f} + \frac {{\left (\tan \left (f x + e\right )^{3} + 3 \, f x + 3 \, e - 3 \, \tan \left (f x + e\right )\right )} b^{2}}{3 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 12.02, size = 76, normalized size = 1.65 \[ \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,a\,b-b^2\right )}{f}+\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,{\left (a-b\right )}^2}{a^2-2\,a\,b+b^2}\right )\,{\left (a-b\right )}^2}{f}+\frac {b^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.32, size = 68, normalized size = 1.48 \[ \begin {cases} a^{2} x - 2 a b x + \frac {2 a b \tan {\left (e + f x \right )}}{f} + b^{2} x + \frac {b^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {b^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\relax (e )}\right )^{2} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________